﻿Public Class Calculation
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_calculate_Click(sender As Object, e As EventArgs) Handles btn_calculate.Click
        lbl_result.Text = getBMI(tb_weight.Text, tb_height.Text)
    End Sub

    Private Function getBMI(ByVal weightstr As String, ByVal heightstr As String) As String
        Dim weight, height, result As Single
        weight = CSng(weightstr)
        height = CSng(heightstr)
        result = weight / (height ^ 2)
        Return CStr(result)
    End Function

End Class